home *** CD-ROM | disk | FTP | other *** search
- { SPX Library Version 3.0 Copyright 1993 Scott D. Ramsay }
-
- SPX_GUI is the Graphical User Interface unit which allows users to create
- screens that are similar to the utilites that are included with the SPX
- Library.
-
- The unit allows of the easy creation an use of push buttons, radio buttons,
- check boxes, string boxes, scroll bars and pick (selecton) boxes. As well as
- popup dialog boxes. Such as the predefined message and yes boxes.
- Some object oriented programming knowledge is nessasary. Review the unit
- SPX_OBJ for more info.
-
- ───────────────────────────────────────────────────────────────────────────
- The SPX_GUI has a system palette of 8 colors. The system colors are saved
- in two different arrays:
-
- wcolortypes = array[0..7] of rgbtype;
- vcolortypes = array[0..7] of byte;
-
- menucolors : wcolortypes
- cl : vcolortypes;
-
- The variable MENUCOLORS contain the red, green, blue values for each of
- the system colors. These are the actual (want) colors for the system palette.
-
- The variable CL contain the index value for each of the system colors. This
- array is used for drawing button objects and screens. CL is defined by
- matching the MENUCOLORS array to closest values in the current VGA palette.
-
- Whenever you change the VGA palette call the procedure adjustmenupalette
- to re-map the CL array.
-
- The default system colors can be changed by changing the values in
- MENUCOLORS then calling adjustmenupalette to re-map CL. Once this is done,
- you should redraw all objects to use the new values contained in CL.
-
- The default color scheme is a gray color scheme. SPX_GUI contains another
- color scheme called "burntsienna". To use:
-
- menucolors := burntsienna; { or menucolors := defaultcolors for default }
- adjustmenupalette;
- { redraw objects }
-
- ──────────────────────────────────────────────────────────────────────────
- Here is an outline of a sample gui program:
-
- { create list }
- { add objects to list }
- { display visible objects }
- repeat
- { get key and mouse strokes }
- { process key and mouse strokes }
- { check if any objects were activated }
- until { done }
- { deallocate list }
-
- Below is a complete program with two push buttons:
-
- Program MyFirstGUI;
-
- {$X+ } { enable extended syntax }
-
- Uses spx_vga,spx_gui,mouse;
-
- const
- id_cool = 1; { button handles or id numbers }
- id_quit = 2;
-
- var
- list : TobjList; { list to contain all objects }
- p,q : pButton; { object pointers }
- pr : integer;
- quit : boolean;
- begin
- openmode(1); { open the graphics mode }
- cls(cl[1]); { clear screen to default background color }
- { check if mouse exist, display message if not found }
- if mousereset=0
- then message('Mouse not installed',true)
- else normalizemx; { check mouse horzontal position }
- list.init; { init your object list }
- { add two buttons }
- list.addobject(new(pButton,init(130,100,50,15,id_cool,#32,false,'|SPACE| COOL')));
- list.addobject(new(pButton,init(130,120,50,15,id_quit,#27,false,'|ESC| Quit')));
- with list do
- begin
- { display all objects within LIST }
- showall;
- { turn on mouse if available }
- mouseon;
- { set exit flag }
- quit := false;
- { program loop... }
- repeat
- inkey; { grab key and mouse strokes }
- pr := checkpress(p); { process key and mouse strokes }
- { check if any objects were activated }
- case pr of
- id_cool : message('You activated the |COOL| button',true);
- id_quit : quit := yes('Exit sample?');
- end;
- until quit;
- { turn off mouse if available }
- mouseoff;
- end;
- { deallocate object list }
- list.done;
- { restore video mode }
- closemode;
- end.
-
- In the above example we added two push buttons. When the first button
- is activated, it displays a message. The second button displays a dialog
- box asking to quit the program.
- The function CHECKPRESS does most of the calculations. It processes
- the key and mouse strokes to check if any objects were activated. If an
- object was activated it will return the object's id/handle number or zero
- if no object was activated. When an object is activated, the pointer P
- points to that object. So in the above example you could change the
- following:
-
- .
- .
- .
-
- q := list.addobject(new(pButton,init(130,100,50,15,id_cool,#32,false,'|SPACE| COOL')));
- q^.msg := 'This is the cool button';
- q := list.addobject(new(pButton,init(130,120,50,15,id_quit,#27,false,'|ESC| Quit')));
- q^.msg := 'This is the exit button';
- .
- .
- .
- case pr of
- id_cool : message(p^.msg,true);
- id_quit : begin
- message(p^.msg,true);
- quit := yes('Exit sample?');
- end;
- end;
-
- The method ADDOBJECT returns a pointer to the object that was just
- added to the list. Each object has a MSG string variable which can be
- set as an info string. See below.
- ───────────────────────────────────────────────────────────────────────────
-
- All window objects inherited from Tbutton object which is a child object
- of Tobjs defined in the SPX_OBJ unit.
-
- Tobjs { generic list object from SPX_OBJ.TPU }
- └─Tbutton { push button object }
- ├─Tpbox { pick "selection" box object }
- ├─Tscroll { scroll bar object }
- └─Tstring { string "input" box object }
- ├─ Tcheck { check box object }
- └─ Tradio { radio button object }
-
- The button objects list is maintained within the object Tobjslist:
-
- Tobjlist = object
- head,tail : plist;
- io : Pmouse_io;
- focus : pbutton;
- gmsg : string;
- orange : pbutton;
- constructor init;
- procedure inkey;virtual;
- procedure clearbuffer;virtual;
- function addobject(item:Pbutton):Pbutton;virtual;
- function checkpress(var p:pbutton):integer;virtual;
- function retobject(hnd:integer):pbutton;virtual;
- procedure showall;virtual;
- destructor done;virtual;
- end;
-
- HEAD,TAIL a linked list of button objects
- IO keyboard, mouse input object.
- FOCUS a pointer to which object has the current focus, NIL if
- none.
- GMSG Set to the last object's MSG variable
- ORANGE contains the Old RANGE or last object that the mouse
- passed over
-
- -----------------------------------------------
- constructor init;
-
- Initalize the object structure
-
- -----------------------------------------------
- procedure inkey;virtual;
-
- Reads the keyboard and mouse. Sets the IO
- object variables. See SPX_GUI.INT for description
- of variables.
-
- -----------------------------------------------
- procedure clearbuffer;virtual;
-
- Clears the keyboard and mouse input buffers.
- -----------------------------------------------
- function addobject(item:Pbutton):Pbutton;virtual;
-
- Adds an object to the object list. Returns a pointer to
- the new object.
-
- ITEM pointer to the object to add to the list.
-
- example:
-
- var
- p : pbutton;
- begin
- list.init;
- p := list.addobject(new(pbutton,init(0,0,40,15,1,#32,false,'SPACE')));
- p^.msg := 'The is button is the SPACE button';
- end;
-
- -----------------------------------------------
- function checkpress(var p:pbutton):integer;virtual;
-
- Searches the linked list processing the key and mouse strokes to check
- if any objects were activated. If an object was activated, it will
- return the object's id/handle number or zero if no object was activated.
- When an object is activated, the pointer P points to that object.
-
- -----------------------------------------------
- function retobject(hnd:integer):pbutton;virtual;
-
- Returns a pointer to an object by specifiying its ID/handle number.
-
- returns NIL if object can not be found
- -----------------------------------------------
- procedure showall;virtual;
-
- Displays all objects in the linked list
- -----------------------------------------------
- destructor done;virtual;
-
- Deallocates the virtual object.
- ───────────────────────────────────────────────────────────────────────────
- Each object is identified by its own unique handle or id number defined
- by your program. An object is activated by the object's hot key or when
- the mouse is clicked on the object. All objects have the basic
- description fields:
-
- id : integer; { from the object Tobjs }
- idnum : word;
- tch : char;
- mmask : byte;
- attr : Tattr;
- title : string;
- titlex,titley : itempos;
- tfunct,
- visible,
- disabled : boolean;
- cdraw,caction : Tproc_a;
- cnear : Tproc_b;
- root : Pobjlist;
- msg : string;
-
- ----------------------------------------------------------
-
- ID inherited from Tobjs. tells the object type:
- id_button = 1; { button id numbers }
- id_string = 2;
- id_check = 3;
- id_radio = 4;
- id_scroll = 5;
- id_pbox = 6;
-
- IDNUM object's unique id number
-
- TCH object's hot key. Character which activates object.
-
- TFUNCT TRUE if TCH is an extended character. i.e. a Function key.
-
- MMASK mouse button mask. Defines which of the mouse button(s) will
- activate the object. Can be the following values:
- mLeftButton = 1;
- mRightButton = 2;
- mBothButtons = 3;
-
- ATTR object's size and position
- Tattr = record
- x,y, { object's top-left position }
- w,h : integer; { object's width and height }
- end;
-
- TITLE object's name or descriptive title
-
- TITLEX,
- TITLEY object's title's position within the object. Can be the
- following values:
- (center,top,left,bottom,right);
-
- VISIBLE set to TRUE if the object is visible. If set to FALSE, the
- object will not be drawn. The object's hot key will still
- activate. Clicking on its area with the mouse will not
- activate the object
-
- DISABLED set to TRUE to disable the object. The object will not be
- drawn and the hot key will not activate the object.
-
- CDRAW Can point user defined procedure. When pointing to a procedure
- it will use that procedure to draw the object. CDRAW must
- point to a FAR procedure and have be defined as the following:
-
- procedure MyCustomDraw(p:pbutton);
-
- This is usefull to create your own object styles.
-
- {$F+ } { declare far }
- procedure MyCustomDraw(p:pbutton);
- begin
- with p^ do
- begin
- { draw object here }
- end;
- end;
-
- CACTION Similar to CDRAW. When overridden, it will be called everytime
- the object is activated.
-
- CNEAR When overridden, the procedure is called when ever the mouse
- initally passes over the object or the mouse just leaves the
- object.
-
- {$F+ }
- procedure MyCustomBorder(p:pbutton;on:boolean);
- begin
- with p^ do
- if on
- then { draw object as focused }
- else { draw object not focused }
- end;
-
- ROOT a pointer that points to the object's linked list definations
-
- MSG a string that describes the object. Usually information that
- will be displayed in an info-bar when the mouse passes over
- the object.
- ───────────────────────────────────────────────────────────────────────────
- ───────────────────────────────────────────────────────────────────────────
- WINDOW OBJECTS
- ───────────────────────────────────────────────────────────────────────────
- TBUTTON - push button object
-
- constructor init(x,y,w,h,idn:integer;ch:char;fnc:boolean;t:string);
-
- Sets up the push button object.
-
- X,Y left-top position of the object
- W,H width and height of the object
- IDN the object's unique id number
- CH objects hot-key
- FNC TRUE if the hot-key is an extended character
- T title of the object
- ------------------------------------------------------
- procedure drawitemobject;virtual;
-
- Inherited from Tobjs. Draws the push button.
- If the variable CDRAW is set to a procedure, it will
- call CDRAW to draw the object.
- ------------------------------------------------------
- procedure nearitemobject(on:boolean);virtual;
-
- Processes the event when a mouse moves over an object. And
- calls the method SHOW to draw/erase a focused button.
-
- ON TRUE if the mouse just moved over the object. FALSE if
- the mouse just left the object.
-
- If the variable CNEAR is set to a procedure, it will
- call CNEAR to handle the drawing/erasing of an object when the
- mouse passes or leaves.
- ------------------------------------------------------
- procedure actionitemobject;virtual;
-
- This procedure is called whenever an object is activated. It calls
- the method SHOWPRESS. If the variable CACTION is set to a procedure,
- it will call CACTION to handle the action required when the object
- is activated
- ------------------------------------------------------
- procedure showpress;virtual;
-
- This procedure is the code procedure of each object. It does the
- default action. For button objects it is an empty procedure. For
- string objects SHOWPRESS would do the text entry.
- ------------------------------------------------------
- procedure show(on:boolean);virtual;
-
- Draws a focus or unfocused object.
-
- ON TRUE - if the object is focused (the mouse is over the object)
- FALSE - if the mouse is not over the object.
- ------------------------------------------------------
- function ncheckhit(hx,hy,ohx,ohy:integer;item:pobjlist):boolean;virtual;
-
- Similar to the method CHECKHIT defined in Tobjs. Checks if the mouse
- is in the object's area or if the hot-key of the object is pressed.
- ------------------------------------------------------
- destructor done;virtual;
-
- Deallocates the virtual object
- ───────────────────────────────────────────────────────────────────────────
- TSTRING - text entry object
-
- esx,esy, { width,height of input area within object }
- epx,epy : integer; { (x,y) position of input area with in object }
- objectx, { Same as TitleX,TitleY sets position of the }
- objecty : itempos; { input area position with in the object }
- spaceok, { Set to TRUE to allow SPACES in text entry }
- upper, { Set to TRUE to allow only upcase }
- numonly : boolean; { Set to TRUE to allow only numbers }
- tlenmax : byte; { Number of characters to display for string }
- tstr : string; { Holds the object's entered string }
- ------------------------------------------------------
- constructor init(x,y,w,h,idn:integer;ch:char;fnc:boolean;t,t2:string;tmax:byte);
-
- Sets up the string object.
-
- X,Y left-top position of the object
- W,H width and height of the object
- IDN the object's unique id number
- CH objects hot-key
- FNC TRUE if the hot-key is an extended character
- T title of the object
- T2 string input text
- TMAX Number of maximum characters to display T2
- ------------------------------------------------------
- procedure drawitemobject;virtual;
-
- See Tbutton.drawitemobject
- ------------------------------------------------------
- procedure showpress;virtual;
-
- See Tbutton.showpress
- ------------------------------------------------------
- procedure filename(px,py:integer;var fname:string);
-
- Called from the method showpress. Does the actual text
- entry.
-
- PX,PY Top-left Position of the text area
- FNAME string to change
-
- Text entry commands:
-
- ENTER or mouse button - Finish typing
- BACKSPACE - Delete character before cursor
- DEL - Delete character at cursor
- HOME - Move to beginning of line
- END - Move to end of line
- Left arrow - Move one character to the left
- Right arrow - Move one character to the right
- ───────────────────────────────────────────────────────────────────────────
- TCHECK - check box object
-
- esx,esy, { width,height of check box within object }
- epx,epy : integer; { (x,y) position of check box within object }
- objectx, { Same as TitleX,TitleY sets position of the }
- objecty : itempos; { check box position with in the object }
- tchk : boolean; { TRUE if the check box is checked }
- ------------------------------------------------------
- constructor init(x,y,w,h,idn:integer;ch:char;fnc:boolean;t:string;chk:boolean);
-
- Sets up the check box object.
-
- X,Y left-top position of the object
- W,H width and height of the object
- IDN the object's unique id number
- CH objects hot-key
- FNC TRUE if the hot-key is an extended character
- T title of the object
- CHK set to TRUE to initially have the object checked
- ------------------------------------------------------
- procedure drawitemobject;virtual;
-
- See Tbutton.drawitemobject
- ------------------------------------------------------
- procedure show(on:boolean);virtual;
-
- See Tbutton.show
- ------------------------------------------------------
- procedure showpress;virtual;
-
- Displays the Check of the object
-
- See Tbutton.showpress
- ----------------------------------------------------
- procedure actionitemobject;virtual;
-
- This method toggles the check box. Then calls showpress
- ───────────────────────────────────────────────────────────────────────────
- TRADIO - radio (single selection) object
-
- group : integer; { identifies the radio button group id number }
-
- Assign radio buttons with the same group id number to allow only one
- radio button within a group to be checked.
- ----------------------------------------------------
- constructor init(x,y,w,h,idn,grp:integer;ch:char;fnc:boolean;t:string;chk:boolean);
-
- Sets up the radio box object.
-
- X,Y left-top position of the object
- W,H width and height of the object
- IDN the object's unique id number
- GRP the radio button's group id number
- CH objects hot-key
- FNC TRUE if the hot-key is an extended character
- T title of the object
- CHK set to TRUE to initially have the object checked
- ----------------------------------------------------
- procedure showpress;virtual;
-
- Displays the check of the radio buttton
- ----------------------------------------------------
- procedure actionitemobject;virtual;
-
- Sets the radio button to CHECKED state and sets all other radio
- buttons within the same group to the UNCHECKED state. Calls the
- methods showpress for ALL radio buttons within the same group
- ───────────────────────────────────────────────────────────────────────────
- TSCROLL - scroll bar object
-
- horz : boolean; { TRUE - if horzontal scroll bar, FALSE - vertical }
- tx1,ty1, { tx1,ty1,tx2,ty2 - scrollable box area }
- tx2,ty2,
- pvlu, { used internally }
- siz, { used internally }
- bmin,bmax, { MIN and MAX values of the scroll bar. Can not be }
- { negative }
- bpos, { Scroll bar value. Always in the range BMIN..BMAX }
- binc : integer; { Value to increment,decrement when arrow area are }
- { pressed }
- ----------------------------------------------------
- constructor init(x,y,w,h,idn,min,max,bi,bp:integer;hz:boolean);
-
- Sets up the scroll box object. Scroll bars do not use hot-keys.
-
- X,Y left-top position of the object
- W,H width and height of the object
- IDN the object's unique id number
- MIN minimum value for scroll bar
- MAX maximum value for scroll bar
- BI value of inc/dec for arrow areas
- BP initial starting postion of scroll bar
- hz TRUE - horzontal FALSE - vertical scroll bar
- ----------------------------------------------------
- procedure showpress;virtual;
-
- Draws the scroll bar position
- ----------------------------------------------------
- procedure drawitemobject;virtual;
-
- See Tbutton.drawitemobject
- ----------------------------------------------------
- procedure redrawscroll;
-
- Redraws the scroll box pointer.
- ----------------------------------------------------
- function porp(vlu,max,min,p1,p2,wd:integer):integer;
-
- Calculates new scroll bar box position
- ───────────────────────────────────────────────────────────────────────────
- TPBOX - Pick (selection) box object
-
- sh,st : plist; { list of string objects }
- lhstr : string; { last string selected }
- lhdat : longint; { data of last string selected }
- items : integer; { max number of items to display }
- ----------------------------------------------------
- constructor init(x,y,w,i,idn:integer;t:string);
-
- Sets up the pick box object. Pick boxes do not use hot-keys.
-
- X,Y left-top position of the object
- W width the object
- I max number of items to list
- IDN the object's unique id number
- T title of the object
- ----------------------------------------------------
- function ncheckhit(hx,hy,ohx,ohy:integer;item:Pobjlist):boolean;virtual;
-
- See Tbutton.ncheckhit
- ----------------------------------------------------
- procedure drawitemobject;virtual;
-
- See Tbutton.drawitemobject
- ----------------------------------------------------
- procedure additem(s:string;d:longint;draw:boolean);virtual;
-
- Adds an entry item to the list. Each entry item has two fields
- a string and longint item. The string item is what is displayed. The
- longint item can be used for your own use.
-
- S String data to add
- D Longint data to add
- DRAW Set to TRUE if to update screen after adding. If set to
- FALSE, use the drawitemobject to update screen at a later time.
- ----------------------------------------------------
- function delitem(s:string;d:longint;draw:boolean):boolean;virtual;
-
- Deletes item from the list. The string and longint value both
- most be equal (case-sensitive). Returns TRUE if successful.
-
- S String to search
- D Longint value to search
- DRAW Set to TRUE if to update screen afer deleting. If set to
- FALSE, use the drawitemobject to update screen at a later time.
-
- ----------------------------------------------------
- function getcount:integer;virtual;
-
- Returns the number of items in the list
- ----------------------------------------------------
- procedure show(on:boolean);virtual;
-
- See Tbutton.show
- ----------------------------------------------------
- destructor done;virtual;
-
- See Tbutton.done
- ───────────────────────────────────────────────────────────────────────────
- ───────────────────────────────────────────────────────────────────────────
- OTHER OBJECTS
- ───────────────────────────────────────────────────────────────────────────
- TKEY_IO = keyboard input object
-
- ch : char; { ASCII character pressed, #1 if no key pressed }
- funct : boolean; { TRUE if (ch) indicates an extended character, such }
- { as a function key }
- ----------------------------------------------------
- constructor init(h:char;f:boolean);
-
- Sets up the tkey_io object.
- h:char; initial value to set (ch)
- f:boolean; initial value to set (funct)
- ----------------------------------------------------
- procedure inkey; virtual;
-
- Reads the keyboard buffer and sets the CH, FUNCT variables
- ----------------------------------------------------
- function apress : boolean; virtual;
-
- Returns TRUE if a key was pressed
- ----------------------------------------------------
- procedure clearbuffer; virtual;
-
- Clears the keyboard buffer, waits until no key is pressed
- ----------------------------------------------------
- destructor done; virtual;
-
- Deallocates the virtual object.
- ───────────────────────────────────────────────────────────────────────────
- Tmouse_IO = keyboard input object
-
- mpx,mpy, { mouse current screen position }
- opx,opy, { mouse old position }
- mop, { mouse button press flag }
- lmop, { mouse old button press flag }
- x,y, { motion coordinate values, range not checked }
- lx,ly:integer; { old motion coordinate value positions }
- ----------------------------------------------------
- constructor init(h:char;f:boolean;sx,sy,m:integer);
-
- Sets up the tmouse_io object.
- h:char; initial value to set (ch)
- f:boolean; initial value to set (funct)
- sx,sx:char; initial value to set (mpx,mpy)
- m initial value to set (mop)
- ----------------------------------------------------
- procedure inkey; virtual;
-
- Reads the keyboard buffer and mouse. Sets keyboard and
- mouse variables.
- ----------------------------------------------------
- function apress : boolean; virtual;
-
- Returns TRUE if a key was pressed or a mouse button
- is pressed
- ----------------------------------------------------
- function mousepressed : boolean; virtual;
-
- Returns TRUE if a mouse button is pressed
- ----------------------------------------------------
- procedure clearbuffer; virtual;
-
- Clears the keyboard buffer, waits until no key and no mouse
- button is pressed
- ----------------------------------------------------
- destructor done; virtual;
-
- Deallocates the virtual object.
- ───────────────────────────────────────────────────────────────────────────
- ───────────────────────────────────────────────────────────────────────────
- OTHER FUNCTIONS
- ───────────────────────────────────────────────────────────────────────────
- function strlen(s:string):word;
-
- Returns a length of a string in pixels.
-
- S String to find width
- ───────────────────────────────────────────────────────────────────────────
- procedure textpos(title:string;tx1,ty1,tx2,ty2:integer;txpos,typos:itempos;var ux,uy:integer);
-
- Sets a string (x,y) position within a rectangular area.
-
- TITLE string to adjust
- tx1,ty1 top-left position of rectangle
- tx2,ty2 bottom-right position of rectangle
- txpos horzontal position
- typos vertical position
- ux,uy return coordinate to place text
-
- EXAMPLE:
-
- var
- x,y : integer;
- begin
- textpos('Hello',10,10,100,100,center,center,x,y);
- putletter(x,y,15,'Hello');
- end;
-
- Displays the text Hello centered within a box
- ───────────────────────────────────────────────────────────────────────────
- procedure pointpos(tx1,ty1,tx2,ty2:integer;txpos,typos:itempos;var ux,uy:integer);
-
- Sets point within a rectangular area.
-
- tx1,ty1 top-left position of rectangle
- tx2,ty2 bottom-right position of rectangle
- txpos horzontal position
- typos vertical position
- ux,uy return coordinate to place point
-
- EXAMPLE:
-
- var
- x,y : integer;
- begin
- pointpos(10,10,100,100,center,center,x,y);
- pset(x,y,15);
- end;
-
- Plots a point centered within a box
- ───────────────────────────────────────────────────────────────────────────
- procedure drawstring(x,y:integer;s:string;c1,c2:byte);
-
- Same as spx_txt.drawstring
-
- ───────────────────────────────────────────────────────────────────────────
- procedure vgaborder(x1,y1,x2,y2:integer;border:boolean);
-
- Draws a 3D button rectangle using the defined system colors. Where
- the top and left sides are highlighted.
-
- x1,y1 top-left position of rectangle
- x2,y2 bottom-right position of rectangle
- border set to TRUE to draw border, FALSE erases with system background
- color cl[sysc_background]
- ───────────────────────────────────────────────────────────────────────────
- procedure vgainvr(x1,y1,x2,y2:integer;border:boolean);
-
- Same as vgaborder. Draws a 3D button rectangle using the defined system
- colors. Where the bottom and right sides are highlighted.
-
- x1,y1 top-left position of rectangle
- x2,y2 bottom-right position of rectangle
- border set to TRUE to draw border, FALSE erases with system background
- color cl[sysc_background]
- ───────────────────────────────────────────────────────────────────────────
- procedure vgarect(x1,y1,x2,y2:integer);
-
- Draws a button rectangle using the system colors. Rectangle is actually
- 2 pixels smaller on each side.
-
- x1,y1 top-left position of rectangle
- x2,y2 bottom-right position of rectangle
- ───────────────────────────────────────────────────────────────────────────
- procedure vgabox(x1,y1,x2,y2:integer);
-
- Draws a button filled box using the system colors. Rectangle is actually
- 2 pixels smaller on each side.
-
- x1,y1 top-left position of rectangle
- x2,y2 bottom-right position of rectangle
-
- ───────────────────────────────────────────────────────────────────────────
- function onwin(x,y,w,h:integer;border:boolean):boolean;
-
- Draws a popup (non-moveable) window using the default system colors. The
- area behind the window is saved to a window stack. Returns TRUE if
- successful.
-
- x,y top-left positon of window
- w,h width and height of window (in pixels)
- border set to TRUE to drawa border around window
-
- ───────────────────────────────────────────────────────────────────────────
- procedure offwin;
-
- Removes the last drawn popup window by restoring the saved background.
- If you want to deallocate the window but keep the window drawn on the
- screen set the flag (WinUpdate) to FALSE before the procedure offwin.
-
- EXAMPLE:
-
- onwin(10,10,150,50,true); { display a window }
- { draw items on window }
- { do popup window stuff }
- offwin; { remove popup window }
- ───────────────────────────────────────────────────────────────────────────
- procedure message(s:string;wait:boolean);
-
- Displays a popup window with a one line message.
-
- s string message to display.
- wait set to TRUE to add a push button to window. The user must press
- the button or the ENTER key to remove the window and continue.
- set to FALSE to display the message and continue. The window
- can be removed by calling the procedure offwin.
-
- EXAMPLE
-
- message('About to load, press ENTER',TRUE); { waits for user }
-
- message('Loading file, please wait...',FALSE); { display message }
- { load file }
- offwin; { remove message window }
- ───────────────────────────────────────────────────────────────────────────
- function yes(msg:string):boolean;
-
- Displays a popup window with two buttons (YES and NO). Returns TRUE if the user
- selects the YES button.
-
- msg a string to display in the box.
-
- EXAMPLE
-
- if yes('Do you want to draw a line?')
- then line(0,0,100,100,14);
-
- Draws a line if the user selects the YES button.
- ───────────────────────────────────────────────────────────────────────────
- function diskdo(x,y:integer;fpath,mask,title:string;loading:boolean):string;
-
- Displays the files selection popup window.
-
- x,y top left position of window
- fpath default file path
- mask default file 3 character extension.
- tite a title for the popup window
- loading set to TRUE for loading files or FALSE for saving files.
-
- Returns the file name (with path) or an empty string if the user
- cancels. If the flag (loading) is set to FALSE, the function will
- prompt to overwrite the file when the user selects OK. Selecting NO
- will return to the file selection window. YES will continue. This
- checking can be disabled by setting the flag (DiskVerify) to FALSE before
- the call to diskdo function.
-
- ───────────────────────────────────────────────────────────────────────────
- procedure finddrives;
-
- Finds all of the available drives. Sets the following two variables with
- the drives in the machine:
-
- drives a string with all available drives
- driveset a set of 'A'..'Z' with all available drives set
- ───────────────────────────────────────────────────────────────────────────
- function writeable(pth:string):boolean;
-
- Returns TRUE if the path is writeable. (able to save files)
-
- pth A path to check if it is writeable.
- ───────────────────────────────────────────────────────────────────────────
- procedure adjustmenupalette;
-
- Reads the current VGA palette then remaps the system colors.
- ───────────────────────────────────────────────────────────────────────────
-
-